import { defineConfig } from '@vben/vite-config';

import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';

const hostIp = '127.0.0.1:3390'; // '192.168.1.17:3389'; // '39.99.130.31:3389'; // '192.168.1.17:3389'; // 39.99.130.31:3389; // 192.168.1.9:3389
export default defineConfig(async () => {
  return {
    application: {},

    vite: {
      plugins: [
        Components({
          resolvers: [
            AntDesignVueResolver({
              importStyle: false, // css in js
            }),
          ],
        }),
      ],
      server: {
        proxy: {
          '/weitong': {
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/weitong/, ''),
            target: `http://${hostIp}/weitong/`,
            ws: true,
          },
        },
      },
      // 路径别名
    },
  };
});
